package com.longge;

public class MinMovesToCaptureTheQueen {


    public int minMovesToCaptureTheQueen(int a, int b, int c, int d, int e, int f) {

        if (a == e) {
            if (c == e) {
                if (b > f) {
                    if (d < f || d > b) {
                        return 1;
                    }
                } else if (b < f) {
                    if (d < b || d > f) {
                        return 1;
                    }
                }
            } else {
                return 1;
            }
        }

        if (b == f) {
            if (d == f) {
                if (a > e) {
                    if (c < e || c > a) {
                        return 1;
                    }
                } else if (a < e) {
                    if (c < a || c > e) {
                        return 1;
                    }
                }
            } else {
                return 1;
            }
        }


        if (Math.abs(c - e) == Math.abs(d - f)) {
            if (Math.abs(a - e) == Math.abs(b - f)) {

                if (e - a > 0 && a - c > 0) {
                    return 2;
                }

                if (e - a < 0 && a - c < 0) {
                    return 2;
                }
                return 1;


            } else {
                return 1;
            }

        }


        return 2;
    }

    public static void main(String[] args) {
        /**
         * 5
         * 8
         * 4
         * 7
         * 1
         * 4
         */
        int i = new MinMovesToCaptureTheQueen().minMovesToCaptureTheQueen(5, 8, 4, 7, 1, 4);
        System.out.println(i);
    }

}
